<?php
/**
 * @authors alex (20779512@qq.com)
 * @date    2014-03-24 17:25:39
 * @version 1.0
 */

class FavAction extends HomeAction {

    public function Index(){
        $obj = M('Fav');
        $map['memberID'] = $this->_user['memberID'];
        $count = $obj->where($map)->count();
        import("@.ORG.WapPage");
        $page = new Page($count, 5);
        $show = $page->show();
        $list = $obj->where($map)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
        $this->assign('list', $list);
        $this->assign('page', $show);
        $this->display();
    }

    public function del(){
        $map['id']=I('get.id');
        $map['memberID'] = $this->_user['memberID'];
        M('Fav')->where($map)->delete();
        redirect ($_SERVER['HTTP_REFERER']);
    }
}